
// 结果集封装
class BaseResult {

    static REQUEST_SUCCESS_CODE = 200;
    static REQUEST_FAILE_CODE = 500;

    constructor(code, msg, data) {
        this.code = code;
        this.msg = msg;
        this.data = data
    }

    static ok(data) {
        return JSON.stringify(new BaseResult(BaseResult.REQUEST_SUCCESS_CODE, "ok", data))
    }

    static notOk(error) {
        return JSON.stringify(new BaseResult(BaseResult.REQUEST_FAILE_CODE, "notOk", error))
    }

}

module.exports = {
    BaseResult
}